import { TweenPlugin } from "./TweenPlugin";
import { TweenLite } from "../TweenLite";
import { PropTween } from "../core/PropTween";
//class TintPlugin
    
    export  class TintPlugin extends TweenPlugin
    {
        constructor()
        {
            
            super();this.propName = "tint";
            this.overwriteProps = ["tint"];
            return;
        }

        public /* override */ onInitTween(arg1: Object, arg2, arg3: TweenLite): Boolean
        {
            if (!(arg1 is flash.display.DisplayObject)) 
            {
                return false;
            }
            var loc1=new Object /* flash.geom.ColorTransform */();
            if (!(arg2 == null) && !(arg3.vars.removeTint == true)) 
            {
                loc1.color = uint(arg2);
            }
            this._ignoreAlpha = true;
            this.init(arg1 as Object /* flash.display.DisplayObject */, loc1);
            return true;
        }

        public init(arg1: Object /* flash.display.DisplayObject */, arg2: Object /* flash.geom.ColorTransform */): void
        {
            var loc2=null;
            this._transform = arg1.transform;
            this._ct = this._transform.colorTransform;
            var loc1=TintPlugin._props.length;
            while (loc1--) 
            {
                loc2 = TintPlugin._props[loc1];
                if (this._ct[loc2] == arg2[loc2]) 
                {
                    continue;
                }
                _tweens[_tweens.length] = new PropTween(this._ct, loc2, this._ct[loc2], arg2[loc2] - this._ct[loc2], "tint", false);
            }
            return;
        }

        public /* override */ set changeFactor(arg1: number)
        {
            var loc1=null;
            updateTweens(arg1);
            if (this._ignoreAlpha) 
            {
                loc1 = this._transform.colorTransform;
                this._ct.alphaMultiplier = loc1.alphaMultiplier;
                this._ct.alphaOffset = loc1.alphaOffset;
            }
            this._transform.colorTransform = this._ct;
            return;
        }

        public static /* const */API: number=1;

        protected /* var */_transform: Object /* flash.geom.Transform */;

        protected /* var */_ct: Object /* flash.geom.ColorTransform */;

        protected /* var */_ignoreAlpha: Boolean;

        protected static /* var */_props: Array<any>;
    }

            TintPlugin._props = ["redMultiplier", "greenMultiplier", "blueMultiplier", "alphaMultiplier", "redOffset", "greenOffset", "blueOffset", "alphaOffset"];
        